import request from '@/utils/request'
const ThirdWechatArticleService = {
  state: {},

  mutations: {},

  actions: {
    /**
     * 文章素材分页
     */
    thirdWechatArticlePage({ commit }, params) {
      return new Promise((resolve, reject) => {
        request.get('thirdWechatArticle/page', params).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    /**
    * 根据主键获得文章素材
    */
    thirdWechatArticleGetById({ commit }, id) {
      return new Promise((resolve, reject) => {
        request.get('thirdWechatArticle/getById/' + id).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    /**
    * 根据主键获得文章素材详情
    */
    thirdWechatArticleGetDetailsById({ commit }, id) {
      return new Promise((resolve, reject) => {
        request.get('thirdWechatArticle/getDetailsById/' + id).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },

    /**
     * 文章素材保存
     */
    thirdWechatArticleSave({ commit }, params) {
      return new Promise((resolve, reject) => {
        request.post('thirdWechatArticle/save', params).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    /**
     * 基本素材保存
     */
    thirdWechatArticleSaveBasic({ commit }, params) {
      return new Promise((resolve, reject) => {
        request.post('thirdWechatArticle/saveBasic', params).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },

    /**
     * 文章素材更新
     */
    thirdWechatArticleUpdate({ commit }, params) {
      return new Promise((resolve, reject) => {
        request.post('thirdWechatArticle/update/' + params.id, params).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    /**
     * 文章素材删除
     */
    thirdWechatArticleRemove({ commit }, params) {
      return new Promise((resolve, reject) => {
        request.post('thirdWechatArticle/remove', params).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    }
  }
}

export default ThirdWechatArticleService
